package com.wuji.blog.controller;

import com.wuji.blog.pojo.param.CommentParam;
import com.wuji.blog.service.CommentService;
import com.wuji.blog.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @作者 wangj
 * @日期 2022/1/20 15:07
 * @描述 common
 **/
@RestController
@RequestMapping("comments")
public class CommentController {
    @Autowired
    private CommentService commentService;

    @GetMapping("article/{id}")
    public Result comments(@PathVariable("id") Long id){
        return commentService.getCommentsByArticleId(id);
    }


    @PostMapping("create/change")
    public Result comment(@RequestBody CommentParam commentParam){
        return commentService.comment(commentParam);
    }
}
